0 CpxTRS
↳1 TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID), 0 ms)
↳2 CpxWeightedTrs
↳3 TypeInferenceProof (BOTH BOUNDS(ID, ID), 0 ms)
↳4 CpxTypedWeightedTrs
↳5 CompletionProof (UPPER BOUND(ID), 0 ms)
↳6 CpxTypedWeightedCompleteTrs
↳7 CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID), 11 ms)
↳8 CpxRNTS
↳9 CompleteCoflocoProof (⇔, 121 ms)
↳10 BOUNDS(1, n^1)
f(n__f(n__a)) → f(n__g(n__f(n__a)))
f(X) → n__f(X)
a → n__a
g(X) → n__g(X)
activate(n__f(X)) → f(X)
activate(n__a) → a
activate(n__g(X)) → g(activate(X))
activate(X) → X
f(n__f(n__a)) → f(n__g(n__f(n__a))) [1]
f(X) → n__f(X) [1]
a → n__a [1]
g(X) → n__g(X) [1]
activate(n__f(X)) → f(X) [1]
activate(n__a) → a [1]
activate(n__g(X)) → g(activate(X)) [1]
activate(X) → X [1]
f(n__f(n__a)) → f(n__g(n__f(n__a))) [1]
f(X) → n__f(X) [1]
a → n__a [1]
g(X) → n__g(X) [1]
activate(n__f(X)) → f(X) [1]
activate(n__a) → a [1]
activate(n__g(X)) → g(activate(X)) [1]
activate(X) → X [1]
f :: n__a:n__f:n__g → n__a:n__f:n__g n__f :: n__a:n__f:n__g → n__a:n__f:n__g n__a :: n__a:n__f:n__g n__g :: n__a:n__f:n__g → n__a:n__f:n__g a :: n__a:n__f:n__g g :: n__a:n__f:n__g → n__a:n__f:n__g activate :: n__a:n__f:n__g → n__a:n__f:n__g |
Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules:
The TRS has the following type information:
Rewrite Strategy: INNERMOST |
n__a => 0
a -{ 1 }→ 0 :|:
activate(z) -{ 1 }→ X :|: X >= 0, z = X
activate(z) -{ 1 }→ g(activate(X)) :|: z = 1 + X, X >= 0
activate(z) -{ 1 }→ f(X) :|: z = 1 + X, X >= 0
activate(z) -{ 1 }→ a :|: z = 0
f(z) -{ 1 }→ f(1 + (1 + 0)) :|: z = 1 + 0
f(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
g(z) -{ 1 }→ 1 + X :|: X >= 0, z = X
eq(start(V),0,[f(V, Out)],[V >= 0]). eq(start(V),0,[a(Out)],[]). eq(start(V),0,[g(V, Out)],[V >= 0]). eq(start(V),0,[activate(V, Out)],[V >= 0]). eq(f(V, Out),1,[f(1 + (1 + 0), Ret)],[Out = Ret,V = 1]). eq(f(V, Out),1,[],[Out = 1 + X1,X1 >= 0,V = X1]). eq(a(Out),1,[],[Out = 0]). eq(g(V, Out),1,[],[Out = 1 + X2,X2 >= 0,V = X2]). eq(activate(V, Out),1,[f(X3, Ret1)],[Out = Ret1,V = 1 + X3,X3 >= 0]). eq(activate(V, Out),1,[a(Ret2)],[Out = Ret2,V = 0]). eq(activate(V, Out),1,[activate(X4, Ret0),g(Ret0, Ret3)],[Out = Ret3,V = 1 + X4,X4 >= 0]). eq(activate(V, Out),1,[],[Out = X5,X5 >= 0,V = X5]). input_output_vars(f(V,Out),[V],[Out]). input_output_vars(a(Out),[],[Out]). input_output_vars(g(V,Out),[V],[Out]). input_output_vars(activate(V,Out),[V],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. non_recursive : [a/1]
1. recursive : [f/2]
2. non_recursive : [g/2]
3. recursive [non_tail] : [activate/2]
4. non_recursive : [start/1]
#### Obtained direct recursion through partial evaluation
0. SCC is completely evaluated into other SCCs
1. SCC is partially evaluated into f/2
2. SCC is completely evaluated into other SCCs
3. SCC is partially evaluated into activate/2
4. SCC is partially evaluated into start/1
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations f/2
* CE 6 is refined into CE [11]
* CE 5 is refined into CE [12]
### Cost equations --> "Loop" of f/2
* CEs [12] --> Loop 7
* CEs [11] --> Loop 8
### Ranking functions of CR f(V,Out)
#### Partial ranking functions of CR f(V,Out)
### Specialization of cost equations activate/2
* CE 7 is refined into CE [13,14]
* CE 8 is refined into CE [15]
* CE 10 is refined into CE [16]
* CE 9 is refined into CE [17]
### Cost equations --> "Loop" of activate/2
* CEs [17] --> Loop 9
* CEs [13] --> Loop 10
* CEs [14,15,16] --> Loop 11
### Ranking functions of CR activate(V,Out)
* RF of phase [9]: [V]
#### Partial ranking functions of CR activate(V,Out)
* Partial RF of phase [9]:
- RF of loop [9:1]:
V
### Specialization of cost equations start/1
* CE 2 is refined into CE [18,19]
* CE 3 is refined into CE [20]
* CE 4 is refined into CE [21,22,23]
### Cost equations --> "Loop" of start/1
* CEs [18,19,20,21,22,23] --> Loop 12
### Ranking functions of CR start(V)
#### Partial ranking functions of CR start(V)
Computing Bounds
=====================================
#### Cost of chains of f(V,Out):
* Chain [8]: 1
with precondition: [V+1=Out,V>=0]
* Chain [7,8]: 2
with precondition: [V=1,Out=3]
#### Cost of chains of activate(V,Out):
* Chain [[9],11]: 2*it(9)+2
Such that:it(9) =< Out
with precondition: [V=Out,V>=1]
* Chain [[9],10]: 2*it(9)+3
Such that:it(9) =< Out
with precondition: [V+1=Out,V>=3]
* Chain [11]: 2
with precondition: [V=Out,V>=0]
* Chain [10]: 3
with precondition: [V=2,Out=3]
#### Cost of chains of start(V):
* Chain [12]: 2*s(2)+2*s(3)+3
Such that:s(3) =< V
s(2) =< V+1
with precondition: []
Closed-form bounds of start(V):
-------------------------------------
* Chain [12] with precondition: []
- Upper bound: nat(V)*2+3+nat(V+1)*2
- Complexity: n
### Maximum cost of start(V): nat(V)*2+3+nat(V+1)*2
Asymptotic class: n
* Total analysis performed in 69 ms.